package com.sky.mapper;

import com.sky.dto.OrdersPageQueryDTO;
import com.sky.entity.OrderDetail;
import com.sky.entity.Orders;
import com.sky.vo.OrderVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface OrdersMapper {
    //保存订单

    void save(Orders orders);

    //根据订单id查询订单信息
    @Select("select * from orders where number=#{orderName}")
    Orders findByNumber(String orderNumber);

    void update(Orders orders);


    List<OrderVO> findList(OrdersPageQueryDTO ordersPageQueryDTO);


    //根据订单id从订单表查询订单基本信息
    @Select("select * from orders where id=#{orderId}")
    OrderVO findById(Long orderId);

    //查询订单
    @Select("select * from orders where status = #{status} and order_time < #{time}")
    List<Orders> findByStatusAndOrderTime(Integer status, LocalDateTime time);
}
